export default {
    namespace: 'test',
    state: {
        value: 0,
        isShow: false
    },
    effects: {
        * increase(d, {put, select}){
            const value = (yield select(state => state.test.value)) + 1;
            yield put({
                type: 'save',
                payload: {
                    value: value,
                    isShow: value > 0
                }
            });
        },
        * minutes(d, {put, select}){
            const value = (yield select(state => state.test.value)) - 1;
            yield put({
                type: 'save',
                payload: {
                    value: value,
                    isShow: value > 0
                }
            });
        }
    },
    reducers: {
        save(state, { payload }) {
            console.log(payload);
            return Object.assign({}, state, payload);
        }
    }
}